Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Max batch size warning #995

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

HammadB
Copy link
Collaborator

@HammadB HammadB commented Aug 15, 2023

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • In v0.4.6 we introduced batching at the sqlite layer for the embeddings_queue to maximize throughput through submit_embeddings calls. SQlite has a max size of variables it can bind at once that is defined at compile time. This changes makes the embeddings_queue introspect its compile time flags to inform its max_batch_size. Max_batch_size is a new property method added to the Producer class that indicates the maximum batch size submit_embeddings() will accept. Right now we use the error internal to submit_embeddings in the sqlite impl, but callers could use this to pre-validate input and throw a message as well.
  • New functionality
    • None

Test plan

Added a test for the below and above batch size cases.

Documentation Changes

We should update the usage guide to cover this caveat.

@HammadB HammadB requested review from jeffchuber and atroyn August 15, 2023 21:53
@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readbility, Modularity, Intuitiveness)

self.VARIABLES_PER_RECORD
)

if self._max_batch_size is None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback is purely defensive.


def __init__(self, system: System):
self._subscriptions = defaultdict(set)
self._max_batch_size = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will cache this.

@HammadB HammadB changed the title Max batch size warning [ENH] Max batch size warning Aug 15, 2023
Copy link
Contributor

@jeffchuber jeffchuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants